<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/layui/css/layui.css"></link>
<link type="text/css" rel="stylesheet" href="__PUBLIC__/Admin/css/H-ui.css"/>
<link type="text/css" rel="stylesheet" href="__PUBLIC__/Admin/css/H-ui.admin.css"/>
<link type="text/css" rel="stylesheet" href="__PUBLIC__/Admin/font/font-awesome.min.css"/>
<script type="text/javascript" src="__PUBLIC__/Admin/js1/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/layer/layer.js"></script>
<script>
function getSon(fid,num) {
	$.ajax({
		url:"__URL__/getson",
		data:"fid="+fid+"&num="+num,
		dataType:'json',
		success:function(re) {
			if(re) {
				$("#tr_"+fid).after(re.html)
				
			}
		},
	})
}
</script>
<title>分类管理</title>
</head>
<body>
<nav class="Hui-breadcrumb"><i class="icon-home"></i> 首页 <span class="c-gray en">&gt;</span> 资讯管理 <span class="c-gray en">&gt;</span> 分类管理 <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="icon-refresh"></i></a></nav>
<div class="pd-20 text-c">
    上级栏目：
    
    <select class="select" id="sel_Sub" name="fid" >
      <option value="0" >顶级分类</option>
         {$optionstr}
    </select>
    <input type="hidden" id="hid_ccid" value="">
    <input class="input-text" style="width:250px" type="text" value="" placeholder="输入分类" id="article-class-val"><button type="button" class="btn btn-success" id="arcitle_add" name=""><i class="icon-plus"></i> 添加</button>
  <div class="article-class-list cl mt-20">
    <table class="table table-border table-bordered table-hover table-bg">
      <thead>
        <tr class="text-c">
          <th width="25"><input type="checkbox" name="" value=""></th>
          <th width="80">ID</th>
          <th width="80">排序</th>
          <th>一级分类</th>
          <th width="70">操作</th>
        </tr>
      </thead>
      <tbody>
        
         <if condition="$arr">
         <foreach name="arr" item="v">
         <tr class="text-c" id="tr_{$v.id}">
          <td><input type="checkbox" name="" value=""></td>
          <td>{$v.id}</td>
          <td>1</td>
          <td class="text-l">{$v.title}</td>
          <td class="f-14">
	          <a title="编辑" href="javascript:;" data-id="{$v.id}" data-name="{$v.title}" style="text-decoration:none" class="save"><i class="icon-edit"></i></a> 
	          <a title="删除" href="javascript:;"  data-id="{$v.id}"  style="text-decoration:none" class="delete"><i class="icon-trash"></i></a>
          </td>
           </tr>
          </foreach>
          <else/>
          <tr>
          <td colspan="5" >暂无数据</td>
          </tr>
          </if>
      
      </tbody>
    </table>
  </div>
</div>
<script>
/* 
*
*添加
*/
$('#arcitle_add').click(function(){
	var id=$('.select').val();
	var name=$('.input-text').val();
      $.post("__URL__/arcitle_list",{name:name,id:id},function(obj){
    	  if(obj.pass==0) {
    			layer.msg(obj.msg,{time:1000,icon:2});
    	  }
    	  if(obj.pass==1) {
    		  layer.msg(obj.msg,{time:1000,icon:1});
    	  }
      })
})
/* 
*
*编辑
*/
$('.save').click(function(){
	var name=$(this).attr('data-name');
	var id=$(this).attr('data-id');

	layer.open({
		type:2,
		content:"__URL__/arcitle_save?id="+id+"&name="+name,
		area:["60%","70%"],
		title:['分类管理','background:#e2e2e2;align:center'],
		shift:3,
	})
})


/* 
*删除
*
*/
$('.delete').click(function(){
	var id=$(this).attr('data-id');
	 layer.confirm("确定删除吗",function(){

		$.post('__URL__/arcitle_delete',{id:id},function(obj){
			if(obj.pass==1) {
				
				layer.msg(obj.msg,{time:1000,icon:1});
			}
		})
	})
})
</script>
</body>
</html>